<?php
include_once('common/header.php');			
$objNews 		= new News();
$objBehaviour	= new Behaviour();
$intNewsId		= $objRequest->getParam('newsid', 0);
$intPage 		= $objRequest->getParam('page', 1);
$arrRow			= $objNews->get($intNewsId);
$intError		= 0;
if($AppUI->id > 0) {
	$objBehaviour->updateRead($AppUI->id,$intNewsId,5);
}
if(isset($arrRow['statuses']) && abs($arrRow['statuses']) > 1) {
	$intError = 1; // deleted
}
if(isset($arrRow) && $intError == 0) {	
	$strTitle	= str_replace('\'','',$arrRow['title']);
	$arrList  	= $objNews->getAll($arrRow['subcategoryid'],$strTitle,$arrRow['newid'],0,0,0,20);	
	$objVfriendUser					= new Vfriend_User();	
	$objNlogs						= new Nlogs();
	$objNlogs->updateRead($AppUI->id, $intNewsId);
	$this->view->row 				= $arrRow;
	$this->view->refer				= isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : LINK_NEWS;
	$this->view->arrList 			= $arrList;
	$this->view->arrUstatForNews	= $objVfriendUser->getUserStat($arrRow['userid']);
	$this->view->intRead			= $objNews->updateRead($arrRow['newid']);
	$this->view->intCheckFollow		= $objNews->getFollow($AppUI->id,$intNewsId);
	include_once('new/comment.php');	
} else {
	Vfriend_Function::setMsg($arrMessage[8]);
	Vfriend_Function::redirect(LINK_NEWS);
}

?>
